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