Is it possible to create a conditional for content_width?

As of now there is no direct way to conditionally set content_width.But we can do this using template_redirect hook and changing the global content_width.This is done in Twenty Fourteen Theme.Following is the code.

/**
 * Adjust content_width value for image attachment template.
 *
 * @since Twenty Fourteen 1.0
 */
function twentyfourteen_content_width() {
    if ( is_attachment() && wp_attachment_is_image() ) {
        $GLOBALS['content_width'] = 810;
    }
}
add_action( 'template_redirect', 'twentyfourteen_content_width' );