Definitely take a look at the settings @Holger_von_Thomsen recommended but also be aware that this issue may be external to the Integration Server. A gateway typically sits between a client, i.e. your IS, and a server, i.e. your DB. It appears the timeout is occurring there and not on the IS.
504 erros are not uncommon when talking to Azure, for example, so try some online searches around 504 errors and the target application you’re trying to talk to and the results may shed some light. Based on your findings, if it indeed appears that the timeout is occurring in the target application, then you can reach out to that team with what you’ve found.
Last but not least, I’m assuming that the errors today are intermittent, right? If so, consider adding an automated retry mechanism in your code so that, in the event of a timeout, the SQL statement is automatically retried.
Hope this helps,
Percio
#webMethods