You can design (or use off-the-shelf power monitor IC) a switch that connects the RAM to a backup battery (or large capacitor, say, 0.5F - called SuperCap) or VCC, whichever is higher .. see example below ..
The backup time depends on the level of quiescent current into the RAM and 30mins with CMOS RAMs should not be a problem ..