UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IULNc9mcDzWMPFlGeQcvBtEmWV84nCI8+7HgeD24HUQ='
WHERE
key_id = '9fd245dcdf6b3b8cc212cdd6aaa2410023e25b51bc19d1b369a9ce3b42fc4360'
AND (
token = 'IULNc9mcDzWMPFlGeQcvBtEmWV84nCI8+7HgeD24HUQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)