When using an OData Connection inside Excel, refresh may time out if the amount of data being refresh is very large. Depending on the amount of data attempting to be refreshed the refresh can take several minutes. By default the Excel Session Timeout setting is set to 450 seconds (7.5 minutes), so if your refresh is taking longer than this time frame, you will see a timeout error.
To increase the timeout setting for Office Web Apps Server 2013 on premise, you can use the following command.
set-officewebappsfarm -excelsessiontimeout <# of sec>
This cannot be changed for Excel Online. If you have a long running query, you can download the workbook, refresh the content in the rich client, and upload back to SharePoint.