You may change one feat to another through retraining. Retraining a feat takes 5 days with a character who has the feat you want. The old feat can’t be one you used as a prerequisite for a feat, class feature, archetype, prestige class, or other ability. If the old feat is a bonus feat granted by a class feature, you must replace it with a feat that you could choose using that class feature.
If, for example, I took Shield Focus to qualify for a Shield Mastery feat, took said Shield Mastery feat, but then I reached Fighter 3 and got Armor Training (which counts as Shield Focus for the purpose of meeting Shield Mastery feat prerequisites) could I then retrain Shield Focus into something more useful now that I no longer need it?