UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i1uaWdv8wYbADFYsWVvhRIE4T07sMzQmkHmjbQnZQus='
WHERE
key_id = 'c1639e3c6b5a133c714587d46ac9220bba30f6acf4dbb128d2ea99fe1bcb257a'
AND (
token = 'i1uaWdv8wYbADFYsWVvhRIE4T07sMzQmkHmjbQnZQus='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)