You can set this in the custom settings in your configuration and this is a setting for the entire project. This applies to data being retrieved for a (template/data)grid and exports done in that grid (excel/csv)
Example config for the yaml config file, section mxruntime:
mxruntime:
[...]
# Abort database SELECT queries that are started from a client XPath request, or XLS/CSV Export
# button and run for more than a minute (ok, a bit more). Nginx has a default proxy gateway
# timeout set at 60 seconds, so continuing while nobody can receive the results anymore is a
# bit pointless...
ClientQueryTimeout: 70