UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XHUl9Qwmb4012m1RJXgpo7VdMym4UlIvNUfvre6eP4U='
WHERE
key_id = '0edfa8f38eb47b7600396a8aa5beec21d4c82a2223967dad20d02bcb113f709f'
AND (
token = 'XHUl9Qwmb4012m1RJXgpo7VdMym4UlIvNUfvre6eP4U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)