hi!
it is not my intention to contradict you... but you need to have a veeeeeery BIIIG set of endlessly slow cycles to make the script take more than 30 seconds to run... i would say that there is a high probability of an endless loop somewhere, however, you may need to edit the php.ini file to extend that time limit, in case the script really takes that long to run.
[]