UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mPPKay0r6UOAtorD4PZCLoU7r+zUBsqJi6IqQzVsjbI='
WHERE
key_id = 'c4dc1018233c1ee55c5e129e79f6889fa1a17cfecf4ec03350b4dc69d81be20c'
AND (
token = 'mPPKay0r6UOAtorD4PZCLoU7r+zUBsqJi6IqQzVsjbI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)