The equals implementation of ProcessInstance now contains key, if the id is not set. The equals implementation of Token also includes equals for ProcessInstance. This means that setting the key properties from within a running process changes the hashcode of the Token and therefore the Process variables will not be found anymore as long as the id of the ProcessInstance is not found.
Furthermore it should be discussed how it affects performance to include ProcessInstance and Processdefinition in every call of equals and hashcode for a Token.