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 = 'vn' 
  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.00043

JSON explain

{
  "query_block": {
    "select_id": 1,
    "having_condition": "processor_status = 'A'",
    "nested_loop": [
      {
        "table": {
          "table_name": "storefronts_payments",
          "access_type": "system",
          "possible_keys": ["PRIMARY", "idx_storefront_id"],
          "rows": 0,
          "filtered": 0,
          "const_row_not_found": true
        }
      },
      {
        "read_sorted_file": {
          "filesort": {
            "sort_key": "cscart_payments.position",
            "table": {
              "table_name": "cscart_payments",
              "access_type": "ALL",
              "possible_keys": ["c_status"],
              "rows": 9,
              "filtered": 100,
              "attached_condition": "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))"
            }
          }
        }
      },
      {
        "table": {
          "table_name": "cscart_payment_descriptions",
          "access_type": "eq_ref",
          "possible_keys": ["PRIMARY"],
          "key": "PRIMARY",
          "key_length": "9",
          "used_key_parts": ["payment_id", "lang_code"],
          "ref": ["demov2026.cscart_payments.payment_id", "const"],
          "rows": 1,
          "filtered": 100,
          "attached_condition": "trigcond(cscart_payment_descriptions.lang_code = 'vn')"
        }
      },
      {
        "table": {
          "table_name": "cscart_payment_processors",
          "access_type": "eq_ref",
          "possible_keys": ["PRIMARY"],
          "key": "PRIMARY",
          "key_length": "3",
          "used_key_parts": ["processor_id"],
          "ref": ["demov2026.cscart_payments.processor_id"],
          "rows": 1,
          "filtered": 100
        }
      },
      {
        "table": {
          "table_name": "cscart_addons",
          "access_type": "eq_ref",
          "possible_keys": ["PRIMARY"],
          "key": "PRIMARY",
          "key_length": "98",
          "used_key_parts": ["addon"],
          "ref": ["demov2026.cscart_payment_processors.addon"],
          "rows": 1,
          "filtered": 100,
          "attached_condition": "trigcond(trigcond(cscart_payment_processors.addon is not null))"
        }
      }
    ]
  }
}

Result

payment_id company_id usergroup_ids position status template processor_id processor_params a_surcharge p_surcharge tax_ids localization payment_category object_id account_id payment description instructions surcharge_title lang_code processor_status processor_type processor_script
12 0 0 0 A views/orders/components/payments/cc_outside.tpl 102 a:8:{s:9:"test_mode";s:1:"Y";s:12:"api_endpoint";s:0:"";s:12:"partner_code";s:21:"MOMOVBVP20240131_TEST";s:10:"access_key";s:16:"oJu2iEaGO4RWWiUW";s:10:"secret_key";s:32:"OT7T8gZODftinWqlGQJOmJBf1BI0HB8R";s:12:"partner_name";s:0:"";s:8:"store_id";s:0:"";s:10:"account_id";s:0:"";} 0.000 0.000 tab1 0 MoMo vn A P momo.php
2 0 0 40 A views/orders/components/payments/phone.tpl 0 0.000 0.000 tab3 0 Phone ordering Call +16175550123 <h2>When I should use phone ordering?</h2><p>Order by phone is useful when regular payment methods like credit card are unavailable or considered insecure.</p><p>Our operators are happy to take your order per phone every business day from 9 a.m. to 5 p.m. UTC.</p> vn A