Validate the keys before setting them when updating the settings