Maybe it is not possible just to do this without saving a thread_id for example?
Call cronjob, check if there is a saved thread_id, else get lowest id, do something, save the id.
Call cronjob, get saved thread_id, if saved, get next thread, do something, save_id, else if there is no higher id, delete saved id
...
combinated with a date; this could run dayly one time until finished?
I have no idea where to save an id and a date, but I guess there should be a million examples in the code.