The law in question is the federal contempt statute, and it was enacted in 1964.
There are lawful methods of solving this problem and it’s on Congress or the Kentucky legislature to make them happen.
This is what Davis should have done, the proper and lawful way to for a government employee to decline to follow a law that conflicts with a religious conviction: http://www.news-journal.com/news/2015/jul/10/rusk-county-clerk-resigns-over-gay-marriage-ruling/