timvisee You get a expiration date when renewing the session.
I store this date/time. If I call the API I verify if it is still valid or not. If not, call the renew session function and then the original call.
You don't need a cronjob or something for this.