UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OzgcO9r1zAS0Z7IRDg3CmgY3dxXyrCnngt2birTHRUo='
WHERE
key_id = '1da551e9731341db4d1e444542f993306e930e437b332460bb9bd2c7affdcd7c'
AND (
token = 'OzgcO9r1zAS0Z7IRDg3CmgY3dxXyrCnngt2birTHRUo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)