UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VWdw1e4IumOsl1hWL3xT2Xd6rByZnIydANCmImLIjEE='
WHERE
key_id = '7ea450392c546651cc287fcff94b64d20e3b24ebf6efb179f1d316b5469d8015'
AND (
token = 'VWdw1e4IumOsl1hWL3xT2Xd6rByZnIydANCmImLIjEE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)