UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IxJJaYNORAXuGa3H45Xh24OGZtOpe4iQIFdaYqz/t9k='
WHERE
key_id = '5038f43962e24f8c065aeee829b2110f1f869f189f56b71afc2f862b08d78d7c'
AND (
token = 'IxJJaYNORAXuGa3H45Xh24OGZtOpe4iQIFdaYqz/t9k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)