Unless the code is doing read-write-read. If you're using a system that doesn't reflect writes immediately (like Elasticsearch), waiting after the writes can give time for the system to flush and make the other writes visible then you can execute rollback logic.
It'd be much better to make sure you're updating the same unique key and/or use the DB's conflict resolution system.