Fix multi-threaded mode insert exception "Unique index or primary key violation", test case by Anatolii K