Rebuild Search Indexes timing out
Craft 3.1.2 added an index-assets console command that you can use instead of the web-based utility. (#3595)

Sounds like that will work better for you :)

Run this to learn more about it:

./craft index-assets --help