Event registration times out with invoicing enabled
Generating a pdf can take a lot of memory and time. If you can turn of the PDF option, that should skip the problem, as Laryn suggested try to turn if off, at least to be sure it's the root problem.

But ff it really takes a lot of time (300 sec is a lot) it might be that you changed the layout of the pdf and/or include too many heavy things (like a huge heavy image for your logo?)

If you do need complex/heavy pdf, one workaround is to let civi delegate the hard work of generating that pdf to an external program. Check if your hosting provider can install wkhtmltopdf and under Admin/system settings/misc put the path of that program into "Path to wkhtmltopdf executable"

I use it for instances that need to generate loads of complex pdfs, the default civi way should work fine for "simple" pdf, it's likely you have something in your setting that is an issue (either faulty pdf layout if you customised it, non optimised images or something)

X+