Apple has agreed to pay $50m (£41.6m) to settle a legal action by claimants in the US, over its MacBook keyboards.