UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9WDOwbYkhZ+MVaSihS7x4ieYko8mRDpWrIILZ+2PMwY='
WHERE
key_id = 'd5ab29a2eebb5a49fcb8af125e0c581790f125c534b7be1d5f5217961e4ecf1d'
AND (
token = '9WDOwbYkhZ+MVaSihS7x4ieYko8mRDpWrIILZ+2PMwY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)