I'm back!
First, you need to be more clear about keys. Is it the same or is it a different key. You do say, another key, but how are you reading that key information. Does the system itself recognize that key as something different or is the input the same?
Do me a favor, try not using joystick for a moment and actually separate this functions into two separate keyboard keys. A & B
Also, you need to describe what result you want from my answer. Right now, I dunno if key meaning moving or not. It's so generic it's hard to replicate.
I would also recommend looking hard at your checks. Like, why does it persist in your state after you let go of the key? Do you not care or check if the key has been released?