ask-user-about-supersession-threat is an autoloaded Lisp function in `userlock.el'.

(ask-user-about-supersession-threat FN)

Ask a user who is about to modify an obsolete buffer what to do.
This function has two choices: it can return, in which case the modification
of the buffer will proceed, or it can (signal 'file-supersession (file)),
in which case the proposed buffer modification will not be made.

You can rewrite this to use any criterion you like to choose which one to do.
The buffer in question is current when this function is called.