When anyone amongst you takes an oath, but he finds (something) better than that he should expiate (the breaking of the oath), and do that which is better. (Using translation from Muslim 1651c)
قَالَ رَسُولُ اللهِ ﷺ «إِذَا حَلَفَ أَحَدُكُمْ عَلَى شَيْءٍ فَرَأَى خَيْرًا مِنْهَا فَلْيُكَفِّرْهَا وَلْيَأْتِ الَّذِي هُوَ خَيْرٌ»