Questions about rejoin

I only have a ST Hub V3 as the coordinator (ZC), and a sensor as the end device (ZED). I want to ask that what if my ZED goes offline, and at the same time my ZC changes its network key? It seems that in this case, ZED still holds the previous NWK keys and tries to connect with ZC, but the key has already changed.

How does ZED notice that the key has been changed?
How does ZED apply for the new key?