During consensus, if two miners mine two different blocks around the same time, then they will broadcast to the network those two different blocks after they have executed the transactions locally and possibly updated their local states.
One of the blocks will end up being in the longest blockchain, so the other block that did not end up in that chain may have updated its owner node's local states. How does that node "undo" the transactions to reset its local states?