Better detection if a full history sync is needed in a multi-process environment

If our stored 'last_sync' timestamp is newer than the logged 'sync'
action in the history database, the last history update aborted for some reason.

If the 'sync' action from the history database is newer, it means
our in-memory version of the data_cache was outdated
and already updated by another process.