How to check if the process instance is in the same status?

we are using Camunda as a backend and workflow engine for our application:

  • we read the data from Camunda process instance vars and present them on custom UI form
  • the user edits and submits the form
  • spring-boot endpoint updates the process instance vars with sumnitted data (message correlation API)
    At the moment of the update, I want to ensure that the process instance has not moved from the state it was at the moment the user has retrieved the initial data.
    Is there a way in Camunda to check if the process instance is still at the same activity?
    Maybe some transaction counter?