The Limit Order are matched based on amount and time. The orders are listed Highest to Lowest on the Buy Side. The orders are listed Lowest to Highest on the Sell Side. If there are 2 Sell orders for same amount the order which is first in time [fractions of milliseconds] is first.

The above is an example of how the orders would look on any exchange.
Now the highest price the buyer is ready to pay is 20.21 and the lowest price a seller is ready to sell for is 20.25. Hence there is no trade.
Now if a new Buy order comes in at 20.25, it matches with the sell and the deal is made.
If a new Buy order comes in at 20.30, it still matches at 20.25.
Similarly if a Sell order come in at 20.21, it matches and a deal is made.
If a Sell order come in at 20.11, it still matches 20.21.
In case of market order, with the above example if there is a Buy order, it would match with the lowest sell order at 20.25, if there is not enough quantity , it would match the remaining quantity to the next highest at 20.31 and continue down. Similarly if there is a Sell market order, the it would match to the maximum a seller is ready to buy, ie 20.21, if there is not sufficient buy quantity at 20.21, it will match with next for 20.19
If say there are new buy order at 20.22 and sell orders at 20.24, these will sit first the the above queue to be matched.
In your above example the Lowest Sell order was at 20.10 at time t1 and hence any buy order after time t1 for amount 20.10 or greater would match to this and the price would be 20.10.
However if the Buy order was first ie at t1 there was a buy order for 20.21 and then at time later than t1, there is a sell order for say 20.10 [amount less than or equal to 20.21] it would match for 20.21.
Essentially the market looks at who was the first to sell at lower price or who was the first to buy at higher price and then decide the trade.
Edit [To Clarify xyz]:
Say if there is an Sell order at $10 Qty 100. There is a buyer who is willing to pay Max $20 and is looking for Qty 500. Your key assumption that the Buyer does not know the current SELL price of $10 is incorrect.
Now there are multiple things, the Buyer knows the lowest Sell order is at $10, he can put a matching Buy order at $10 Qty 100, and say $11 Qty 100 etc. This is painful.
Second, lets say he puts a Buy order at $10 Qty 100, by the time the order hits the system someone else has put the trade at $10 and his order is fulfilled. So this buyer has to keep looking at booking and keep making adjustments, if its a large order, it would be extremely difficult and frustrating for this Buyer. Hence the logic of giving preference.
The later Buy order says ... The Max I can pay is $20, match eveything at the current price and get the required shares.