SELECT 
  cscart_payments.*, 
  cscart_payment_descriptions.*, 
  IF (
    ISNULL(cscart_addons.status), 
    "A", 
    cscart_addons.status
  ) AS processor_status, 
  cscart_payment_processors.type AS processor_type, 
  cscart_payment_processors.processor_script AS processor_script 
FROM 
  cscart_payments 
  LEFT JOIN cscart_payment_descriptions ON cscart_payment_descriptions.payment_id = cscart_payments.payment_id 
  AND cscart_payment_descriptions.lang_code = 'ar' 
  LEFT JOIN cscart_payment_processors ON cscart_payment_processors.processor_id = cscart_payments.processor_id 
  LEFT JOIN cscart_addons ON cscart_payment_processors.addon = cscart_addons.addon 
  LEFT JOIN cscart_storefronts_payments AS storefronts_payments ON storefronts_payments.payment_id = cscart_payments.payment_id 
WHERE 
  cscart_payments.status = 'A' 
  AND (
    cscart_payments.usergroup_ids = '' 
    OR FIND_IN_SET(
      0, cscart_payments.usergroup_ids
    ) 
    OR FIND_IN_SET(
      1, cscart_payments.usergroup_ids
    )
  ) 
  AND (
    storefronts_payments.storefront_id = 1 
    OR storefronts_payments.storefront_id IS NULL
  ) 
HAVING 
  processor_status = 'A' 
ORDER BY 
  cscart_payments.position

Query time 0.00123

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "2.91"
    },
    "ordering_operation": {
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "1.00"
      },
      "nested_loop": [
        {
          "table": {
            "table_name": "storefronts_payments",
            "access_type": "system",
            "rows_examined_per_scan": 0,
            "rows_produced_per_join": 1,
            "filtered": "0.00",
            "const_row_not_found": true,
            "cost_info": {
              "read_cost": "0.00",
              "eval_cost": "0.10",
              "prefix_cost": "0.00",
              "data_read_per_join": "16"
            },
            "used_columns": [
              "storefront_id",
              "payment_id"
            ]
          }
        },
        {
          "table": {
            "table_name": "cscart_payments",
            "access_type": "ALL",
            "possible_keys": [
              "c_status"
            ],
            "rows_examined_per_scan": 10,
            "rows_produced_per_join": 1,
            "filtered": "10.00",
            "cost_info": {
              "read_cost": "1.51",
              "eval_cost": "0.10",
              "prefix_cost": "1.61",
              "data_read_per_join": "2K"
            },
            "used_columns": [
              "payment_id",
              "company_id",
              "usergroup_ids",
              "position",
              "status",
              "template",
              "processor_id",
              "processor_params",
              "a_surcharge",
              "p_surcharge",
              "tax_ids",
              "localization",
              "payment_category"
            ],
            "attached_condition": "((`betaatif_store`.`cscart_payments`.`status` = 'A') and ((`betaatif_store`.`cscart_payments`.`usergroup_ids` = '') or (0 <> find_in_set(0,`betaatif_store`.`cscart_payments`.`usergroup_ids`)) or (0 <> find_in_set(1,`betaatif_store`.`cscart_payments`.`usergroup_ids`))))"
          }
        },
        {
          "table": {
            "table_name": "cscart_payment_descriptions",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "payment_id",
              "lang_code"
            ],
            "key_length": "9",
            "ref": [
              "betaatif_store.cscart_payments.payment_id",
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.00",
              "eval_cost": "0.10",
              "prefix_cost": "1.71",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "payment_id",
              "payment",
              "description",
              "instructions",
              "surcharge_title",
              "lang_code"
            ]
          }
        },
        {
          "table": {
            "table_name": "cscart_payment_processors",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "processor_id"
            ],
            "key_length": "3",
            "ref": [
              "betaatif_store.cscart_payments.processor_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.00",
              "eval_cost": "0.10",
              "prefix_cost": "1.81",
              "data_read_per_join": "3K"
            },
            "used_columns": [
              "processor_id",
              "processor_script",
              "type",
              "addon"
            ]
          }
        },
        {
          "table": {
            "table_name": "cscart_addons",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "addon"
            ],
            "key_length": "98",
            "ref": [
              "betaatif_store.cscart_payment_processors.addon"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.00",
              "eval_cost": "0.10",
              "prefix_cost": "1.91",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "addon",
              "status"
            ]
          }
        }
      ]
    }
  }
}

Result

payment_id company_id usergroup_ids position status template processor_id processor_params a_surcharge p_surcharge tax_ids localization payment_category payment description instructions surcharge_title lang_code processor_status processor_type processor_script
12 0 0 0 A views/orders/components/payments/urway.tpl 106 a:5:{s:11:"terminal_id";s:9:"alabdulla";s:8:"password";s:15:"alabd@URWAY_753";s:12:"merchant_key";s:64:"33d5d0c111ae2e8302a8fc6e0c84426a559f86dcc90a66d184df2931af535120";s:11:"request_url";s:82:"https://payments.urway-tech.com/URWAYPGService/transaction/jsonProcess/JSONrequest";s:16:"transaction_type";s:1:"1";} 0.000 0.000 tab1 بيانات البطاقة ar A P urway.php
14 0 0 0 A addons/sg_tamara/views/orders/components/payments/sg_tamara.tpl 107 a:3:{s:9:"api_token";s:572:"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhY2NvdW50SWQiOiJmYmE5YWZhNy1hMGI1LTQ2YzctYjM0ZS0yNTY2YzI1ZTZmNjciLCJ0eXBlIjoibWVyY2hhbnQiLCJzYWx0IjoiNjYxYTRmNDk4NmNlNmQzY2E3MTc3NTVhMWMyNWI5YjkiLCJpYXQiOjE2ODY4NDI3MzgsImlzcyI6IlRhbWFyYSJ9.Brlg6TO8fAQdeDltKKMlSRtv-lLwZlCGtIGHrjZCgRWvcpEI_pCyqwghp7ar8IKgb-WROpEn0em37O6plvNtKItnbJ1OTAFrd_MsBFBgQfiPxEAH_hPUif1VwEDBVjTDa4i2WKwY-TQ7nMzZNyYKbLd6BAYOv0ErdeKmJWdrvuvFg6ZMAAAJQndNYaCpHugXftv09s37T_BqPbfSMK4Wo1X9WzBr_6HD4PTK3ZtdC-J98tDoYTIYoZy1lnglcGzLbRHEeGyuecXjD7u2y9Y3CWikrlymcmkhBgUhd8i9az1XqG8rVmhyN1DanxIEOODZo1COdsIhUGFhQg7Bi02Icg";s:18:"notification_token";s:0:"";s:9:"succeeded";s:1:"P";} 0.000 0.000 tab1 Tamara Payment ar A P sg_tamara.php