"The Messenger of Allah said: 'Whoever swears an oath, then sees something better than it, let him leave his oath, and do that which is better, and offer expiation for it.'"
Sunan an-Nasa'i Book 35, Hadith 26