UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'U9NpDExa1R1/87Q3XgSgvDqVlojriFQMimHfQOZ5A6s='
WHERE
key_id = 'a360b40ac78d33a17c84b2dea47120531dac7bf972a57b48999964262d70e4c6'
AND (
token = 'U9NpDExa1R1/87Q3XgSgvDqVlojriFQMimHfQOZ5A6s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)