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