Hi,
From what I understand, the issue is not with MySQL. Since this happens during the checkout, I suppose that you must have configured some shipping methods or tax plugin which needs to connect to another server to get the shipping rates/tax rates and the connection to the server takes a lot of time.
So to check on that disable the shipping methods and see if you still have the problem.
If you don't, then please check with your hosting on why the connection with the server of the shipping method you're using is so long.