Multiple Drupal Commerce line items in the database but one in the order page
I finally found out how to do what I want.
The last commerce line items are in the field_data_commerce_line_items table. The commerce_line_item table seems to contain all the commerce line item revisions.

SELECT SUM(quantity)
FROM {commerce_line_item}
INNER JOIN {field_data_commerce_line_items}
    ON {field_data_commerce_line_items}.commerce_line_items_line_item_id = {commerce_line_item}.line_item_id
WHERE order_id = 388


I don't know if it is documented somewhere.
However, it is what I found by reading the source code and the SQL queries.