UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5veZhG6nKmGBBS1s3iHBGMrRbY5u5I2Kx+2DJn6Aas0='
WHERE
key_id = 'c96a0d1a4e5a1cf642aa051fdca4383380f53df29004fd40193969e39cbeb7df'
AND (
token = '5veZhG6nKmGBBS1s3iHBGMrRbY5u5I2Kx+2DJn6Aas0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)