Sum custom field values of particular taxonomy

You would have to JOIN a couple of tables.

SELECT meta_value FROM wp_postmeta as pm
INNER JOIN wp_term_relationships as tr ON (pm.post_id = tr.object_id) 
INNER JOIN wp_term_taxonomy as tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) 
WHERE 1
AND tt.taxonomy = 'laptop'
AND pm.meta_key = 'quantity'

I am fairly sure that is right. These things are complicated.

If your meta_value is a number– that is, no punctuation or other spaces– you should be able to use SUM(meta_value) and avoid the array_sum after the fact.