UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2d2qvzjh4fj4eaV7scKmQELvwSPRUWeErQ96113r1oA='
WHERE
key_id = '77965bcffbaa6fd81003053365f31d210580761d2390762a0aef7a8c66ed0ef0'
AND (
token = '2d2qvzjh4fj4eaV7scKmQELvwSPRUWeErQ96113r1oA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)