if the smart contract has terms to be met in a time order(assuming in one year time frame) and transactions corresponding to the terms, what will happen to the variables stored in the contract account when two different user accounts initiate the smart contract one after another and are being mined by the same miner? For example, the smart contract is about paying money at different stages of constructing an apartment building, and is used between a construction company and different apartment buyers.
Transactions are executed sequentially. Let's suppose we have two transaction T1 and T2 that call to contract C.
During T1 execution it can modify the state of C. When T2 start it will see the modified state.
If you only want the first transaction to succeed, the contract have to provide that logic for that. For example C set a variable to at creation to false, when a transaction is executed it check the variable if false continue, and if is true it will fail, on success it will set the variable to true.