SELECT 
  mdi.mdi_id, 
  mdi.tag, 
  mdi.is_faq, 
  mdi.is_open, 
  mdi.status, 
  mdi.position, 
  mdi.item_type, 
  mdi.filling_type, 
  mdi.filling_data, 
  mdi.position_on_page, 
  mdid.lang_code, 
  mdid.title, 
  mdid.description 
FROM 
  cscart_ab__md_items as mdi 
  LEFT JOIN cscart_ab__md_item_settings item_settings ON mdi.mdi_id = item_settings.item_id 
  AND item_settings.object_type = 'category' 
  LEFT JOIN cscart_ab__md_items_links global_links_include ON global_links_include.item_id = mdi.mdi_id 
  AND global_links_include.object_type = 'category' 
  AND (
    global_links_include.object_id = 1861 
    AND global_links_include.link_type = 'I'
  ) 
  LEFT JOIN cscart_ab__md_items_links global_links_exclude ON global_links_exclude.item_id = mdi.mdi_id 
  AND global_links_exclude.object_type = 'category' 
  AND (
    global_links_exclude.object_id = 1861 
    AND global_links_exclude.link_type = 'E'
  ) 
  INNER JOIN cscart_ab__md_item_descriptions AS mdid ON (
    mdi.mdi_id = mdid.mdi_id 
    AND mdid.lang_code = 'en' 
    AND IF(
      mdi.item_type = 'elements', 
      TRIM(mdid.description) != '', 
      TRIM(mdid.title) != ''
    )
  ) 
WHERE 
  1 
  AND item_settings.status = 'A' 
  AND (
    item_settings.is_global = 'Y' 
    OR global_links_include.object_id is not null
  ) 
  and global_links_exclude.object_id is null 
  AND mdi.status = 'A' 
ORDER BY 
  mdi.status asc, 
  mdi.position asc, 
  mdid.title asc

Query time 0.00133

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "4.00"
    },
    "ordering_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "nested_loop": [
        {
          "table": {
            "table_name": "mdi",
            "access_type": "ALL",
            "possible_keys": [
              "PRIMARY"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.25",
              "eval_cost": "0.10",
              "prefix_cost": "0.35",
              "data_read_per_join": "336"
            },
            "used_columns": [
              "mdi_id",
              "tag",
              "is_faq",
              "is_open",
              "status",
              "position",
              "position_on_page",
              "item_type",
              "filling_type",
              "filling_data"
            ],
            "attached_condition": "(`s2cart`.`mdi`.`status` = 'A')"
          }
        },
        {
          "table": {
            "table_name": "item_settings",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "item_id",
              "object_type"
            ],
            "key_length": "156",
            "ref": [
              "s2cart.mdi.mdi_id",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.25",
              "eval_cost": "0.10",
              "prefix_cost": "0.70",
              "data_read_per_join": "168"
            },
            "used_columns": [
              "item_id",
              "object_type",
              "status",
              "is_global"
            ],
            "attached_condition": "(`s2cart`.`item_settings`.`status` = 'A')"
          }
        },
        {
          "table": {
            "table_name": "global_links_include",
            "access_type": "ref",
            "possible_keys": [
              "object_id",
              "item_id"
            ],
            "key": "object_id",
            "used_key_parts": [
              "object_id",
              "object_type"
            ],
            "key_length": "156",
            "ref": [
              "const",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "1.00",
              "eval_cost": "0.10",
              "prefix_cost": "1.80",
              "data_read_per_join": "168"
            },
            "used_columns": [
              "id",
              "object_id",
              "object_type",
              "item_id",
              "link_type"
            ],
            "attached_condition": "(<if>(found_match(global_links_include), ((`s2cart`.`item_settings`.`is_global` = 'Y') or (`s2cart`.`global_links_include`.`object_id` is not null)), true) and <if>(is_not_null_compl(global_links_include), ((`s2cart`.`global_links_include`.`item_id` = `s2cart`.`mdi`.`mdi_id`) and (`s2cart`.`global_links_include`.`link_type` = 'I')), true))"
          }
        },
        {
          "table": {
            "table_name": "global_links_exclude",
            "access_type": "ref",
            "possible_keys": [
              "object_id",
              "item_id"
            ],
            "key": "object_id",
            "used_key_parts": [
              "object_id",
              "object_type"
            ],
            "key_length": "156",
            "ref": [
              "const",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "not_exists": true,
            "cost_info": {
              "read_cost": "1.00",
              "eval_cost": "0.10",
              "prefix_cost": "2.90",
              "data_read_per_join": "168"
            },
            "used_columns": [
              "id",
              "object_id",
              "object_type",
              "item_id",
              "link_type"
            ],
            "attached_condition": "(<if>(found_match(global_links_exclude), (`s2cart`.`global_links_exclude`.`object_id` is null), true) and <if>(is_not_null_compl(global_links_exclude), ((`s2cart`.`global_links_exclude`.`item_id` = `s2cart`.`mdi`.`mdi_id`) and (`s2cart`.`global_links_exclude`.`link_type` = 'E')), true))"
          }
        },
        {
          "table": {
            "table_name": "mdid",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "mdi_id",
              "lang_code"
            ],
            "key_length": "10",
            "ref": [
              "s2cart.mdi.mdi_id",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "1.00",
              "eval_cost": "0.10",
              "prefix_cost": "4.00",
              "data_read_per_join": "792"
            },
            "used_columns": [
              "mdi_id",
              "lang_code",
              "title",
              "description"
            ],
            "attached_condition": "(0 <> if((`s2cart`.`mdi`.`item_type` = 'elements'),(trim(`s2cart`.`mdid`.`description`) <> ''),(trim(`s2cart`.`mdid`.`title`) <> '')))"
          }
        }
      ]
    }
  }
}