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