What I did many times in the past is to have two areas in flash: "normal run" and "update". "Normal run" has the running firmware and "update" is an area where the running firmware will use to store a new version.
It goes like this: the new firmware version is flashed to the "update" area in flash, usually with a header and a checksum. Then the bootloader will check for this header/checksum in the "update" area and if valid, will flash the contents of "update" area into "normal run" area. Then the contents of "update" are invalidated (erased) and the bootloader jumps to "normal run" as usual.
If any of the above fails, the firmware will be just re-written. The above is also valid for checking if the new firmware is authorized to run (signed, whatever).
I know some Nordic chips have special registers for this purpose.