UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'agqpwWTjZixW+3c0gN04siBy07IzBV3Anhr0f4UejPY='
WHERE
key_id = '4bc46d544e74219f1d0175624bf1e962320a22b6953103a862b135caf45dac4d'
AND (
token = 'agqpwWTjZixW+3c0gN04siBy07IzBV3Anhr0f4UejPY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)