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