UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1hFgpZFnxfla2gDmumOu2+hYLPOV3n/6XZYTeen+mmQ='
WHERE
key_id = '666b2dcf85f96d0f54ebd1740e2cbd7d9e25b17741e5391bf258b21b2ced2e02'
AND (
token = '1hFgpZFnxfla2gDmumOu2+hYLPOV3n/6XZYTeen+mmQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)