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