There is a hard limit for any request of 60 seconds and if you want more time than that you should use Task Queues API which can run in the background for up to 10 minutes which should be more than enough in your case.
Before diving deep into the Task Queues you could try the background work with the deferred library which is actually using Task Queue API but makes it much easier to work with.