Add token generation function. Allow restoration of cart via URL. Add base function for the cron job. See #1257.