UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fdklhw7nbtqK5koejsdT2qXbyXxozXWfLFauYF9KNGw='
WHERE
key_id = '51b8ae33246e0f42b3185870c360b8b9241ca619563e476bdeb1fd416bc1a54b'
AND (
token = 'fdklhw7nbtqK5koejsdT2qXbyXxozXWfLFauYF9KNGw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)