Improve KeyForMailbox readability and behavior
Checking wether or not the key is revoked etc. is now done
in a helper function to avoid the large if checks.
This should also better handle cases where multiple revoked / expired
/ disabled keys are found. Where it was previously unclear which
of them would be chosen now It is the first key found.