UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qnqU1ouiIdshSBO3eaRTg1KkpNKxnZnm4M7jso1AeaE='
WHERE
key_id = '7c4feb865d56544aa79261ddafffe24ea7e376c17c4c1a6f6d68abafb99648a0'
AND (
token = 'qnqU1ouiIdshSBO3eaRTg1KkpNKxnZnm4M7jso1AeaE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)