UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jHlhthKVAuLC5s1Ln8WvAX9hqpWuf4wJOSF+BBHiaGs='
WHERE
key_id = '15e2c2cd738c96f687bea5f71d4c40053b6db3242f03657b5e4316f5690475f3'
AND (
token = 'jHlhthKVAuLC5s1Ln8WvAX9hqpWuf4wJOSF+BBHiaGs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)