UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CVGZ1HRX4Y8i/vl8Fp8XYulF5/0ThKaRFegIcLI/p7I='
WHERE
key_id = 'bd2d07435efb592eb4eb956bb65161a5762ea50dd6333898b426574a3e6fc12a'
AND (
token = 'CVGZ1HRX4Y8i/vl8Fp8XYulF5/0ThKaRFegIcLI/p7I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)