UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g4qLsA2mFd3rCJmoMtGyuJY7mKYNNWaRCkgsAKGgUSA='
WHERE
key_id = '04ab6745ec8d5adb4305b71b60b1a653d1fb52695afaf7e1fade9bd116b3e2eb'
AND (
token = 'g4qLsA2mFd3rCJmoMtGyuJY7mKYNNWaRCkgsAKGgUSA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)