UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fk+UtqvD1XCE/BD7zSRhJ8Rv8yFemaEp24/0/UW+suY='
WHERE
key_id = 'beb71246a01cf0ff0964f6862cd0c0179c0aaf39311aeb1bd734fc842425f2fb'
AND (
token = 'fk+UtqvD1XCE/BD7zSRhJ8Rv8yFemaEp24/0/UW+suY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)