I don't completely understand your circuit, but you could put a low-leakage diode and a resistor between the +5V and the lithium battery +.
When the 5V was present, the resistor could provide all the current the RTC needs. When the 5V wasn't present, the battery would power the chip.
Bookmarks