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