Flops, motives and invariance of quantum rings