[beta] Do not update semantically equivalent lockfiles with --frozen/--locked.
A previous patch in #4684 attempted to fix this, but didn't work for the
case where the [root] crate wasn't the first crate in the sorted package
array.
Backport of https://github.com/rust-lang/cargo/pull/4714.