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