I think what you want to do is very tricky.
On what condition should the modify button be disabled for a user?
Anyway I think a call to the database shoulod be made to detect if the entity was updated or checked-out (flag) to be modified.
And while this check may pass when the user fetches the entity, it may fail when he attempts to update the entity. (the entity state might get changed between him fetching the entity and saving it).
So anyway a database check upon attempting to save is crucial.