PLAT-167: Changed the order of saving to avoid the situation in which
the job is taken before the batch_job_lock_id is set.