How to use script block on transition

Every transition has script block

I would do some update when transition is use.

how to write correct query?

SET STATUS = 'Etap1'
WHERE ID = _Task.Key

It's highly recommended that you update tasks from Workflow classes. Example:

TI := TTaskInstance.Create(nil);
TI.Key := MyTaskInstanceKey;
TI.Status := ‘closed’; //set the status to a final status you want 

No, I can't.

I have a few transitions between two blocks. 

When workflow reaches Block 2, I want to know which transition was used.

You can simply put script blocks after each transition and process a custom code for each case. After the script blocks, go to the Block 2.

Can you show me, how to do insert/update in script blocks on every transition?

Actually if you just want to execute an SQL statement, you can use the Database block, which is built for that purpose. Just drop the database block and write the SQL you want to be executed in the database.

Or, how to set adequte internal status on Block 2 depending which transition was used?

You don't do that in advance. Before the Block 2 is reached, no task is created (I assume Block 2 is a task block, right)? You can't set a task status before it's created. I've been asking you specific and technical questions about database access, but what exactly you want to achieve (at a higher level)?

I define new variable.

On every transition i set the variable: my_variable := 'transition1'.
How to read the variable, when workflow reach Block2?

If you are using a script block, you can access the variable directly from script:

if my_variable = 'transition1' then // ...

If you are using a task block, there are some places you can refer to the variable content using brackets. For example, if you want to include the variable content in the subject or description of the task, you use:

This is "my_variable" content: [my_variable] 

I need to read my variable from application (from Delphi)

Once you have the workflow instance key, you can use it to load a TWorkflowInstance object:

WorkIns := TWorkflowInstance.Create(nil, WorkflowStudio);
WorkIns.Key := ATaskIns.WorkInsKey;

VarValue := WorkIns.Diagram.Variables.FindByName(VariableName).Value;