Query to join two subsets of table data (get it faster)
A few things that can improve your query:


There is no need for the derived tables (subqueries). You can have a 4-table join in the FROM clause.
Once we do the above, it's obvious that you join table1 to itself on a column that seems to be UNIQUE: (ON glv.keycode = gln.keycode). We can remove this join, so the result is a 3-table join.


The query:

SELECT 
    t1.id, 
    t1.value  AS keycode, 
    ln.teksts AS teksts_ln  
FROM
    table1 AS t1 
    LEFT JOIN table2 AS lv 
      ON t1.value = lv.keycode AND lv.lang_id = 5        
    LEFT JOIN table2 AS ln
      ON t1.value = ln.keycode AND ln.lang_id = 10
WHERE 
    t1.stat = '1' 
ORDER BY 
    t1.weight ASC, lv.teksts ASC ;


After we have it working correctly (producing the same results), you can improve efficiency by adding indexes:


on table2 (lang_id, keycode, teksts)
on table1 (stat)