This is a common error we see with WooCommerce. At this time, we are not sure what is causing this, but it’s related to your database.
The problem: Your database table called wp_wc_download_log contains 2 foreign keys and you need to remove one.
One is called:
wp_woocommerce_downloadable_product_permissions (which is the correct key you need).
The other one is similar with the same name but with a prefix. Something like:
You need to delete this key.
For more info about this issue, refer to the official thread here: https://wordpress.org/support/topic/unable-to-insert-download-log-entry-in-database/