How to optimize SQL with WHERE and ORDER BY
Q1: I don't understand why primary is chosen here?


The index you made helps neither the WHERE or the ORDER BY due to the columns in the wrong order.

Since you selected only the erp_orders_id, the PRIMARY KEY was chosen.


  Q2: Why is this query so slow even with execution plan indicates that it scanned only 1 row?


Since you forced the index, the entire index was scanned until one row was found that matched o.orders_export_time &gt;= '2015-09-20'. If you have rows from earlier months, even earlier years, those rows would be read until '2015-09-20' was finally found.


  Q3 how am I supposed to optimize this query?


As @dnoeth said in the comment, reverse the column order in the index.

ALTER TABLE `erp_orders` 
ADD KEY `IDX_ORDERID_EXPORTTIME`(`orders_export_time`,`erp_orders_id`) USING BTREE;