I have used "which" in a situation where two entities use things, but one entity used a different thing in the second time while the other entity stuck to the same thing it used in the first time.
I find it phrased weakly (I mean by weakly that it didn't express the meaning strongly enough):
"A" changed its key and got XORed with "B" which used the same key as in the first time.
What I mean by that sentence is: A trial has occurred where "A" used a different key in the second time of the trial while "B" stuck to the same key it (refers to "B") used for the first time of the trial.
I thought of using in which but a user has stated in their answer to a question on ELL:
In which may head a relative clause in which the which must stand as the object of the preposition in.
He put the book in that cupboard.
... which leads me to the conclusion that it can't work for my case.
I have also thought of using where:
"A" changed its key and got XORed with "B" where it used the same key as in the first time.
But it kind of indicates that "B" is a place rather than an entity.
Another way I tried for expressing it:
"A" changed its key and got XORed with "B" which in return used the same key as in the first time.
But "in return" would mean because of the change "A" has done, "B" did that.
So, what is the best relative pronoun or phrase that can fit and express the sentence accurately?