update_post_meta is Updating with two page id

It’s probably Firefox prefetching pages, which it can do based on the rel attribute of links (see https://stackoverflow.com/a/18156967/664741). You could alter these links to remove eg rel="next", or you could detect Firefox prefetching by checking the headers sent:

if ( ! isset( $_SERVER['HTTP_X_MOZ'] ) || $_SERVER['HTTP_X_MOZ'] != 'prefetch' ) {
    add_action( 'wp', 'function_name' );
}