Right, I guessed as much.
Seeing how you’re using WordPress, I think the issue is called by WP-Cron. The first time you visit your website again, WordPress will use the first page request to perform background tasks. Those tasks include checking for plugin and theme updates, but plugins can add their own code as well. This will result in the first page view in a while to take quite a bit longer than subsequent ones.
In your case, it seems to take so long that the server actually gives up waiting for the code to complete, which results in the error.
Fortunately, you can also run the WP-Cron tasks separate from the web requests, like so:
Please try setting the cron job as described and see if this helps.