Update magellan keys script

- Now determines a tenant to use for the user.
- Now correctly handles case where key is deleted multiple times.