'Adi bin Hatim At-Ta'i (May Allah be pleased with him) said:
I heard the Messenger of Allah (ﷺ) say: "He who has taken an oath (to do something) but found something else better than that (which brings him closer to Allah), then he should do that which is better in piety (and he should expiate for the breaking of oath)".[Muslim].
Arabic/English book reference: Book 1, Hadith 72