UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M9tzUBucb52/84byNC5zFn8cz6R7Twx0yT7E4YgHi3M='
WHERE
key_id = 'f2293d56d5f16df834526b2a599a421a9a88aab8895216f7495ee27b1fb545be'
AND (
token = 'M9tzUBucb52/84byNC5zFn8cz6R7Twx0yT7E4YgHi3M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)