UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BbXyPF3054j8FJxT3eAy+Qi+JW1Pge6KycmD3DLpep8='
WHERE
key_id = '64f08042a89909b3d92d193cb5a406be5a198225b0bacd56489245d7ae8d1aae'
AND (
token = 'BbXyPF3054j8FJxT3eAy+Qi+JW1Pge6KycmD3DLpep8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)