Email addresses are related records, and the opt_out field is in email_addresses table.
I found this example online, it deletes all email addresses, which is not what you want, but it should be enough to get you going with the iteration of the email addresses linked to a Contact…
if ($bean->load_relationship('email_addresses')) {
$relatedBeans = $bean->get_linked_beans('email_addresses', 'email_address');
foreach ( $relatedBeans as $relatedBean ) {
$bean->email_addresses->delete($bean->id, $relatedBean->id);
}
}
Your field is probably there at $bean->email_addresses->opt_out
Check the database, there are other fields there controlling confirmed opt_in, etc.