UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZEdc1TCZXetB9KyjTPMnyBwq2OQH+rSDbC4tEAvZf7Y='
WHERE
key_id = 'cfedaf08c72366ad65730252ddc9262487e6b4432ec26958f2b983653636eaec'
AND (
token = 'ZEdc1TCZXetB9KyjTPMnyBwq2OQH+rSDbC4tEAvZf7Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)